<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui" />
<meta name="format-detection" content="telephone=no" />
<title>商品购买信息</title>
<meta content="" name="keywords" />
<meta content="" name="description" />
<meta content="" name="copyright" />
<meta content="" name="author" />
<meta name="robots" content="noarchive">
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/map.js"></script>
<script type="text/javascript" src="layer/layer.js"></script>
<script type="text/javascript" src="js/urlTool.js"></script>
<script type="text/javascript" src="js/mescroll.min.js"></script>
<script type="text/javascript" src="js/zepto.min.js"></script>
<script type="text/javascript" src="js/zepto.weui.js"></script>
<link rel="stylesheet" href="css/weui.css"/>
<link rel="stylesheet" href="css/weuix.css"/>
<link rel="stylesheet" href="css/public.css" />
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/swiper.min.css" />
<link rel="stylesheet" href="css/mescroll.min.css">
</head>

<body class="">
    <!--头部-->
    <div class="return_top bgyellow">
        <a href="javascript:history.go(-1);">
            <span class="login_home cfff">返回</span>
        </a>
    </div>
    <!--//头部结束-->
<!--主体区域-->
<div class="bgfff cb7 pl20 pr20 pb120">
    <p class="tc fz30 pt50 cblue">商品购买信息</p> 
    <form action="" method="post" enctype="multipart/form-data">
        <div class="clear">
            <div class="weui-cells weui-cells_form">
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label for="date" class="weui-label fz28 c333" style="width:70px;">使用日期</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input fz30" id="date" type="text">
                    </div>
                </div>
            </div>
            <div id="inline-calendar"></div>              
        </div>

        <div class="c333 pt20 fz28 clear">
            <label for="buynum" class="fl buygood_tltle pt10">购买数量</label>
            <input type="number" placeholder="请输入购买数量" id="buynum" class="buygood_input pb20 fl">
        </div>

        <div class="car_cont">
            <button type="button" class="w100 car_cont_submit fz32 cfff" onclick="return buygoodFunction()">去付款</button>
        </div>
    </form> 
</div>

<!--底部-->
<div class="footerpage"></div>
<!--//底部-->
</body>

<script>
$(".footerpage").load("footer.html",'',function() {    
    $('#shopCart').addClass("select-two").children().attr("class","shopCartclick");
});
var openid= getQueryVariable("orderNo");

var sameday = new Date();
sameday.setTime(sameday.getTime());
var samedays = sameday.getFullYear()+"-" + (sameday.getMonth()+1) + "-" + sameday.getDate();
$("#date").calendar({
    dateFormat:'yyyy-mm-dd',
    minDate:samedays,
});

function buygoodFunction(){
    var buynum = $('#buynum').val();
    var date = $('#date').val();
    if (date == "" || date == undefined || date == null || date.length < 1){
        layer.open({
            content:'请选择使用日期！'
            ,btn: '我知道了'
        });
        return false;
    }
    if (buynum == "" || buynum == undefined || buynum == null || buynum.length < 1){
        layer.open({
            content:'请填写购买数量！'
            ,btn: '我知道了'
        });
        return false;
    }
    var order_data={'proId':openid,'orderType':0,'useDay':date,'proNum':buynum};
    order_pay(order_data);
}
function order_pay(order_data){
    sm.req({
        url: '/sysOrder/creat',
        dataType:'json', 
        type:'post',
        data: order_data,
        done: function (res){
            location.href="mybuy.html?orderNo="+res.data.orderNo+"&orderPrice="+res.data.orderPrice+"&proName="+res.data.proName+""         
        }
    })
    return false;
}
</script>
</html>